package com.qf.dao.Impl;

import com.qf.dao.EmpmanagerDao;
import com.qf.pojo.Empmanager;
import com.qf.utils.Dbutils;
import com.qf.utils.Sqlutil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class EmpmanagerDaoImpl implements EmpmanagerDao {
    QueryRunner queryRunner = new QueryRunner();
    @Override
    public Empmanager select(String username) {
        String sql = Sqlutil.getSqlL("selectusername");
        try {
            Empmanager query = queryRunner.query(Dbutils.getConnection(), sql, new BeanHandler<>(Empmanager.class),username);
            return query;
        } catch (SQLException e) {
            throw new RuntimeException(e.getMessage()+"查询管理员异常");
        }
    }
}
